<title>日志管理</title>

<div class="layui-card layadmin-header">
    <div class="layui-breadcrumb" lay-filter="breadcrumb">
        <a lay-href="">主页</a>
        <a><cite>系统管理</cite></a>
        <a><cite>日志列表</cite></a>
    </div>
</div>

<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <blockquote class="layui-elem-quote quoteBox">
                    <form class="layui-form">
                        <div class="layui-inline">
                            <div class="layui-input-inline">
                                <input type="text" class="layui-input " placeholder="请输入搜索的内容" />
                            </div>
                            <a class="layui-btn search_btn" data-type="reload">搜索</a>
                        </div>
                        <div class="layui-inline">
                            <a class="layui-btn layui-btn-normal">添加用户</a>
                        </div>
                        <div class="layui-inline">
                            <a class="layui-btn layui-btn-danger layui-btn-normal ">批量删除</a>
                        </div>
                    </form>
                </blockquote>

                <div class="layui-card-body">
                    <table class="layui-hide" id="test-table-form"></table>

                    <script type="text/html" id="test-table-checkboxTpl">

          </script>

                </div>
            </div>
        </div>
    </div>
</div>

<!--操作-->
<script type="text/html" id="userListBar">
    <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
    <a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="del">删除</a>
    <a class="layui-btn layui-btn-xs layui-btn-primary" lay-event="look">预览</a>
</script>

<script>
    layui.use(['admin', 'table', 'form'], function(){
        var table = layui.table
            ,form = layui.form
            ,$ = layui.$;

        table.render({
            elem: '#test-table-form'
            ,url:'/sys/user/list'
            ,where: {
                token: layui.data('layuiAdmin').token
            }
            ,cellMinWidth: 80
            ,cols: [[
                {type:'numbers'}
                ,{type: 'checkbox'}
                ,{field:'userId', title:'ID', width:80, unresize: true, sort: true}
                ,{field:'username', title:'用户名'}
                ,{field:'email', title:'邮箱',width:180}
                ,{field:'mobile', title: '电话', minWidth:120, sort: true}
                ,{field:'status', title:'状态', width:110,templet:function(d){
                        return d.status == "1" ? "正常" : "禁用";
                    }}
                ,{field:'createTime', title:'创建时间',width:180}
                ,{title: '操作', width:170, templet:'#userListBar',fixed:"right",align:"center"}
            ]]
            ,page: true
        });

        //监听性别操作
        form.on('switch(test-table-sexDemo)', function(obj){
            var json = JSON.parse(decodeURIComponent($(this).data('json')));
            layer.tips(this.value + ' ' + this.name + '：'+ obj.elem.checked, obj.othis);

            json = table.clearCacheKey(json);
            console.log(json); //当前行数据
        });

        //监听锁定操作
        form.on('checkbox(test-table-lockDemo)', function(obj){
            var json = JSON.parse(decodeURIComponent($(this).data('json')));
            layer.tips(this.value + ' ' + this.name + '：'+ obj.elem.checked, obj.othis);

            json = table.clearCacheKey(json);
            console.log(json); //当前行数据
        });

    });
</script>